<template>
<div>

  <el-table
      :data="tableData"
      border
      style="width: 100%">
    <el-table-column
        prop="id"
        label="序号"
        width="180">
    </el-table-column>
    <el-table-column
        prop="checkStatus"
        label="考勤状态"
        width="180">
    </el-table-column>
    <el-table-column
        prop="hours"
        label="对应小时数">
      <template slot-scope="scope">
        <el-input v-model="scope.row.hours"></el-input>
      </template>
    </el-table-column>
    <el-table-column
        prop="score"
        label="分值">
      <template slot-scope="scope">
        <el-input v-model="scope.row.score"></el-input>
      </template>
    </el-table-column>
  </el-table>
  <el-divider></el-divider>
  <el-button type="primary" @click="save">保存</el-button>

</div>
</template>

<script>
export default {
  data() {
    return {
      attendence:undefined,
      firstleave:undefined,
      secondleave:undefined,
      nightleave:undefined,
      late:undefined,
      secondlate:undefined,
      firstlate:undefined,
      absence:undefined,
      nightlate:undefined,
      alldayleave:undefined,

      javascore:undefined,
      testscore:undefined,
      webscore:undefined,

      tableData: [{
        id: 1,
        checkStatus: '正常出勤',
        hours: 9,
        score:9

      },{
        id: 2,
        checkStatus: '上午请假',
        hours: -9,
        score:-9

      }, {
        id: 3,
        checkStatus: '下午请假',
        hours: -9,
        score:-9

      },{
        id:4,
        checkStatus: '晚自习请假',
        hours: -9,
        score:-9

      },{
        id: 5,
        checkStatus: '全天请假',
        hours: -9,
        score:-9

      },{
        id: 6,
        checkStatus: '迟到',
        hours: -9,
        score:-9

      },{
        id: 7,
        checkStatus: '上午旷到',
        hours: -9,
        score:-9

      },{
        id: 8,
        checkStatus: '下午旷到',
        hours:-9,
        score:-9

      },{
        id: 9,
        checkStatus: '晚自习早退',
        hours: -9,
        score:-9

      },{
        id: 10,
        checkStatus: '全天旷到',
        hours: -9,
        score:-9

      }]

    };
  },
  methods: {

    save(){
      this.$axios({
        url:'/saveCheckStatus',
        method:'post',
        data:this.tableData
      }).then(res=>{
        console.log(res)
        if(res.status==200){
          this.$message.success('保存成功')
        }else{
          this.$message.error('保存失败')
        }
      })
    }

  },
  created(){

  }
}
</script>
